<template>
<div>
  <van-field label="账号：" v-model="form.username"/>
  <van-field label="密码：" v-model="form.password"/>
  <van-button @click="denglu">登录</van-button>
</div>
</template>

<script>
import maxios from '../../http/axios'
export default {
name: "login",
  data(){
  return{
    form:{}
    }
  },
  methods:{
    denglu(){
      maxios('loginM','post',this.form).then(res=>{
        if(res.code==200){
          alert(res.mes)
          localStorage.setItem('userid',res.userid)
          localStorage.setItem('token',res.token)
          localStorage.setItem('url',JSON.stringify(res.url))
        }else {
          alert(res.mes)
        }
      })
    }
  }
}
</script>

<style scoped>

</style>